import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.FileReader;
import java.util.ArrayList;

public abstract class LoadedSettings 
{
	final public static String defaultGesturesFilename = "res/gestures.txt";
	final public static String defaultModificatorsFilename = "res/modificators.txt";
	final public static String defaultAttributesFilename = "res/attributes.txt";
	
	
	final String filename;
	final protected static String SPLITTER = ";";
	protected LoadedSettings(String file)
	{
		filename = file;
	}
	
	ArrayList<String> load()
	{
		FileReader fReader = null;
		BufferedReader reader = null;
		ArrayList<String> lines = new ArrayList<String>();
		try 
		{
			fReader = new FileReader(filename);
			reader = new BufferedReader(fReader);
			String line;
			while( (line = reader.readLine()) != null )
			{
				lines.add(line);
			}
		} 
		catch (FileNotFoundException e) 
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (IOException e) 
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally
		{
			if(reader != null)
			{
				try 
				{
					reader.close();
				} 
				catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if(reader != null)
			{
				try 
				{
					fReader.close();
				}
				catch (IOException e)
				{
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		return lines;
	}
}